#include "FAQCryptoRegister.h"
#include "crypto/algorithms/symmetric/Rijndael.h"
#include "crypto/algorithms/symmetric/SM4.h"
#include "crypto/algorithms/nullalgorithm/NullAlgorithm.h"
#include "crypto/algorithms/nullalgorithm/NullKeyGenerator.h"
using namespace yzrilyzr_collection;
using namespace yzrilyzr_lang;
namespace yzrilyzr_crypto{
	HashMap<String, std::shared_ptr<FAQCipherAlgorithm>> FAQCryptoRegister::ciphers;
	HashMap<String, std::shared_ptr<FAQDigestAlgorithm>> FAQCryptoRegister::digests;
	HashMap<String, std::shared_ptr<FAQSignAlgorithm>> FAQCryptoRegister::signers;
	HashMap<String, std::shared_ptr<FAQMacAlgorithm>> FAQCryptoRegister::macs;
	HashMap<String, std::shared_ptr<FAQKeyAgreementAlgorithm>> FAQCryptoRegister::keyAgreements;
	HashMap<String, std::shared_ptr<FAQKeyDerivationFunction>> FAQCryptoRegister::kdfs;
	HashMap<String, std::shared_ptr<FAQKeyPairGenerator>> FAQCryptoRegister::keyPairGenerators;
	void FAQCryptoRegister::registerDefaultCiphers(){
		static bool initialized=false;
		if(initialized)return;
		initialized=true;
	// --- 1. 注册密钥对生成器 ---
		//registerKeyPairGenerator("EC", std::make_shared<ECKeyPairGenerator>());
		registerKeyPairGenerator("NULL", std::make_shared<NullKeyGenerator>());
		// --- 2. 注册对称加密算法 (Cipher) ---
		// 注意：这里注册的是基础算法，具体模式和填充在使用时指定，或者作为完整名称注册
		registerCipher("AES", std::make_shared<Rijndael>());
		registerCipher("RIJNDAEL", std::make_shared<Rijndael>());
		registerCipher("SM4", std::make_shared<SM4>());
		registerCipher("NULL", std::make_shared<NullAlgorithm>()); // 假设NullAlgorithm也实现了Cipher接口
		// --- 3. 注册非对称加密和签名算法 ---
		// 非对称加密
		//registerCipher("EC", std::make_shared<EC>());
		// 签名
		//registerSigner("ECDSA", std::make_shared<ECDSA>());
		// --- 4. 注册密钥协商算法 ---
		//registerKeyAgreement("ECDH", std::make_shared<ECDH>());
		// --- 5. 注册摘要算法 (Digest) ---
		//registerDigest("SHA-1", std::make_shared<SHA1>());
		//registerDigest("SHA1", std::make_shared<SHA1>());
		//registerDigest("SHA-256", std::make_shared<SHA256>());
		//registerDigest("SHA256", std::make_shared<SHA256>());
		//registerDigest("SHA3-224", std::make_shared<SHA3.SHA3_224>());
		//registerDigest("SHA3-256", std::make_shared<SHA3.SHA3_256>());
		//registerDigest("SHA3-384", std::make_shared<SHA3.SHA3_384>());
		//registerDigest("SHA3-512", std::make_shared<SHA3.SHA3_512>());
		//registerDigest("SHAKE128", std::make_shared<SHA3.SHAKE128>());
		//registerDigest("SHAKE256", std::make_shared<SHA3.SHAKE256>());
		//registerDigest("SM3", std::make_shared<SM3>());
		// --- 6. 注册MAC算法 ---
		// HMac是一个通用框架，它与不同的摘要算法组合
		//registerMac("HMACSHA1", std::make_shared<HMac>(std::make_shared< SHA1>()));
		//registerMac("HMACSHA256", std::make_shared<HMac>(std::make_shared< SHA256>()));
		//registerMac("HMACSHA3-224", std::make_shared<HMac>(std::make_shared< SHA3.SHA3_224>()));
		//registerMac("HMACSHA3-256", std::make_shared<HMac>(std::make_shared< SHA3.SHA3_256>()));
		//registerMac("HMACSHA3-384", std::make_shared<HMac>(std::make_shared< SHA3.SHA3_384>()));
		//registerMac("HMACSHA3-512", std::make_shared<HMac>(std::make_shared< SHA3.SHA3_512>()));
		//registerMac("HMACSM3", std::make_shared<HMac>(std::make_shared< SM3>()));
		// --- 7. 注册密钥派生函数 (KDF) ---
		//registerKdf("HKDFSHA3-256", std::make_shared<HKDF>(std::make_shared< SHA3.SHA3_256>()));
		//registerKdf("HKDFSM3", std::make_shared<HKDF>(std::make_shared< SM3>()));
		//registerKdf("PBKDF2WithHmacSHA1", std::make_shared<PBKDF2WithHmac>(std::make_shared< SHA1>()));
		//registerKdf("PBKDF2WithHmacSHA3-256", std::make_shared<PBKDF2WithHmac>(std::make_shared< SHA3.SHA3_256>()));
	}
	static FAQCryptoRegister _FAQCryptoRegister;
}